// 获取媒体设备
export const getUserMedia = () => {
  return new Promise((resolve,reject) => {
    navigator.getUserMedia({ audio: true, video: true }, (stream) => {
      resolve(stream)
    },(e)=>{
      reject(e)
    })
  })
}

// 将视频转为base64图片
export const screenCapture = (video)=>{
  const canvas = document.createElement("canvas");
  const canvasCtx = canvas.getContext("2d");
  canvas.width = 360;
  canvas.height = 240;
  canvasCtx.drawImage(video, 0, 0, canvas.width, canvas.height);
  return canvas.toDataURL("image/png");
}
